﻿//双击事件
var CustomDbClick = function () {//屏蔽双击事件
    //parent.closeWin();
    fnBrowseResume();
}

//添加
var fnCustomAdd = function () {
    document.getElementById("EditUIWindow").src = "../EHR/hrUploadResume.aspx";
    SetDWH(500, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
    //var k = window.showModalDialog("../EHR/hrUploadResume.aspx", window, "dialogWidth=450px;dialogHeight=300px;status=no;help=no;scroll=yes");
}

var fnBatchUpload = function () {
    //alert("");
    document.getElementById("EditUIWindow").src = "/Extend/ViewList.aspx?isShonwBtn=Y&entity=V_hrCandidate&condition=1=0";
    SetDWH(750, 550, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//编辑
var fnCustomEdit = function () {
    alert("不允许修改!");
    return;
}

//点击"简历"按钮后触发,查看原始简历信息
var fnBrowseResume = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    else {
        var id = record.getData(const_entityID);
        YAHOO.util.Connect.asyncRequest('POST', "/EHR/hrAjax.aspx?flag=getresume&id=" + id, {
            success: function (res) {
                try {
                    var str = res.responseText;
                    if (str != "-1") {
                        var CName = record.getData("Name");
                        var pagetitle = "简历信息——" + CName;
                        parent.addTabs(pagetitle, "/EHR/tempfiles/" + str);
                        parent.NeedRefreshPage = this;
                        //window.open("../EHR/upload/tempresume.htm"); 
                        //window.open("../EHR/upload/tempresume.htm", "newwindow", "modal=yes,width=800,height=600,resizable=no,scrollbars=no,location=no,menubar=no,alwaysRaised=yes");
                        //                        document.getElementById("dialog5_h").innerHTML = record.getData("CandidateName") + "简历";
                        //                        document.getElementById("EditUIWindow3").src = "../EHR/upload/tempresume.htm";
                        //                        SetDWH(800, 600, YAHOO.example.container.dialog5);
                        //                        YAHOO.example.container.dialog5.show();
                        //暂时用模态窗口
                        //window.showModalDialog("../EHR/tempfiles/" + str, window, "dialogWidth=" + window.screen.width + "px;dialogHeight=" + window.screen.height + "px;status=no;help=no;scroll=yes;resizable=yes");
                    }
                    else {
                        alert("获取简历失败！");
                    }
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    }
}

//界面初始化
if (typeof ($) != "undefined") 
{
    $(document).ready(function () {
        
    });
}

var SelectData = function () {

    const_Condition = encodeURI("PostID='" + $("#posts").attr("SValue") + "'");
    fnUploadResume($("#posts").attr("SValue"));
    RefreshData();
}

var fnUploadResume = function (postid) {
    //alert(postid);
    document.getElementById("EditUIWindow").src = "/Extend/UploadFile.aspx?entity=V_hrCandidate&id=" + postid;
    SetDWH(650, 450, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

var fnBatchUploadResume = function () {
    fnUploadResume("");
}